home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / pgp23src.zip / SRC / CRYPTO.H < prev    next >
C/C++ Source or Header  |  1993-05-09  |  3KB  |  87 lines

  1. /* crypto.h - C headers for crypto.c 
  2. */
  3.  
  4. /* Used to determine if nesting should be allowed */
  5. boolean legal_ctb(byte ctb);
  6.  
  7. /* Write an RSA-signed message digest of input file to specified output
  8.    file, and append input file to output file */
  9. int signfile(boolean nested, boolean separate_signature, char *mcguffin,
  10.              char *infile, char *outfile, char lit_mode, char *literalfile);
  11.  
  12. /* Reads the first count bytes from infile into header */
  13. int get_header_info_from_file(char *infile, byte *header, int count);
  14.  
  15. /* RSA-encrypt a file */
  16. int encryptfile(char **mcguffin, char *infile, char *outfile, 
  17.     boolean attempt_compression);
  18.  
  19. /* Encrypt file with IPES/IDEA cipher */
  20. int idea_encryptfile(char *infile, char *outfile, 
  21.     boolean attempt_compression);
  22.  
  23. /* Prepend a CTB_LITERAL prefix to a file */
  24. int make_literal(char *infile, char *outfile, char lit_mode, char *literalfile);
  25.  
  26. /* Decrypt a file (RSA or IPES/IDEA) */
  27. int decryptfile(char *infile, char *outfile);
  28.  
  29. /* Check signature in infile for validity.  Strip off the signature and
  30.    write the remaining packet to outfile */
  31. int check_signaturefile(char *infile, char *outfile, boolean strip_signature,
  32.             char *preserved_name);
  33.  
  34. /* Decrypt file with IPES/IDEA only */
  35. int idea_decryptfile(char *infile, char *outfile);
  36.  
  37. /* Decompress a file with ZIP algorithm */
  38. int decompress_file(char *infile, char *outfile);
  39.  
  40. /* Strip off literal prefix from infile, copying to outfile */
  41. int strip_literal(char *infile, char *outfile, char *preserved_name,
  42.         char *lit_mode);
  43.  
  44. /* Write a multiprecision integer to a file */
  45. void write_mpi(unitptr n, FILE *f, boolean scrambled);
  46.  
  47. /* Read a mutiprecision integer from a file */
  48. int read_mpi(unitptr r, FILE *f, boolean adjust_precision, boolean scrambled);
  49.  
  50. /* Convert C <-> Quiche strings */
  51. void CToPascal(char *s);
  52. void PascalToC( char *s );
  53.  
  54. /* Tests if a randseed.bin file exists already */
  55. int seedfile_exists(void);
  56.  
  57. /* Creates a randseed.bin file (call if above returns false) */
  58. void create_seedfile(void);
  59.  
  60. /*    Return date string, given pointer to 32-bit timestamp */
  61. char *cdate(word32 *tstamp);
  62.  
  63. /*    Return date and time string, given pointer to 32-bit timestamp */
  64. char *ctdate(word32 *tstamp);
  65.  
  66. /* Return current timestamp as a byte array and as a 32-bit word */
  67. word32 get_timestamp(byte *timestamp);
  68.  
  69. /*    Returns the length of a packet according to the CTB and the length field */
  70. word32 getpastlength(byte ctb, FILE *f);
  71.  
  72. /* Write a CTB with the appropriate length field */
  73. void write_ctb_len (FILE *f, byte ctb_type, word32 length, boolean big);
  74.  
  75. /* Print an error message and return nonzero if val != checkval */
  76. int version_error (int val, int checkval);
  77.  
  78. int check_key_sig(FILE *fkey, long fpkey, int keypktlen, char *keyuserid,
  79.      FILE *fsig, long fpsig, char *keyfile, char *siguserid, byte *xtimestamp,
  80.      byte *sigclass);
  81.  
  82. int squish_file(char *infile, char *outfile);
  83.  
  84. int signkey(char *keyguffin, char *sigguffin, char *keyfile);
  85.  
  86. extern int compromise(byte *keyID, char *keyfile);
  87.